﻿<%@ Page Title="Check Out" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CheckOut.aspx.cs" Inherits="MyLocalChurch.KidsChurch.CheckOut" %>
<%@ Import Namespace="MyLocalChurch.Models.Enumerations" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $(".barcode").focus();
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager ID="scriptManager" runat="server">
    </asp:ScriptManager>
    <h2>Check Out</h2>
    <asp:Label ID="lblMessage" runat="server" CssClass="message"></asp:Label>
    <h3>Guardian's/PreTeen's Barcode (<a href="GuardiansList.aspx">No barcode?</a>):</h3>
    <div>
        <asp:TextBox ID="txtBarcode" CssClass="barcode" runat="server"
            AutoCompleteType="None" AutoPostBack="True"
            OnTextChanged="txtBarcode_TextChanged"></asp:TextBox>
        <br />
        <asp:Button ID="btnRefresh" Text="Refresh" runat="server" OnClick="btnRefresh_Click"/>
    </div>
    <div class="block">
        <asp:UpdatePanel ID="updatePanelGuardian" runat="server" Visible="False">
            <ContentTemplate>
                <h3>Guardian's Information</h3>
                <div class="left">
                    <table>
                        <tr>
                            <td>First Name:</td>
                            <td><asp:Label ID="lblGuardianFirstName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Middle Name:</td>
                            <td><asp:Label ID="lblGuardianMiddleName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Last Name:</td>
                            <td><asp:Label ID="lblGuardianLastName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Nick Name:</td>
                            <td><asp:Label ID="lblGuardianNickName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Gender:</td>
                            <td><asp:Label ID="lblGuardianGender" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Birth Date:</td>
                            <td><asp:Label ID="lblGuardianBirthDate" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Mobile Number:</td>
                            <td><asp:Label ID="lblGuardianMobileNumber" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>E-mail Address:</td>
                            <td><asp:Label ID="lblGuardianEmailAddress" runat="server"></asp:Label></td>
                        </tr>
                    </table>
                </div>
                <div class="right">
                    <table>
                        <tr>
                            <td>
                                Profile Photo:
                                <br />
                                <asp:Image runat="server" ID="guardianImagePreview" CssClass="profilePhoto" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Additional Information:
                                <br />
                                <asp:TextBox ID="txtGuardianAdditionalInformation" runat="server" TextMode="MultiLine" Rows="5" ReadOnly="True"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </div>
  
                <h3>Kid's to Check Out</h3>
                <table>
                    <thead>
                        <tr>
                            <th>
                                <asp:CheckBox ID="chkKidSelectAll" runat="server" AutoPostBack="True"
                                    OnCheckedChanged="chkKidSelectAll_CheckedChanged"/>
                            </th>
                            <th>First Name</th>
                            <th>Middle Name</th>
                            <th>Last Name</th>
                            <th>Nick Name</th>
                            <th>Gender</th>
                            <th>Birthdate</th>
                            <th>Category</th>
                            <th>Relationship</th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="rptKids" runat="server" OnItemDataBound="rptKids_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <asp:CheckBox ID="chkKid" runat="server" AutoPostBack="True"/>
                                        <input type="hidden" id="hiddenKidId" runat="server"/>
                                    </td>
                                    <td><%# DataBinder.Eval(Container.DataItem, "FirstName") %></td>
                                    <td><%# DataBinder.Eval(Container.DataItem, "MiddleName") %></td>
                                    <td><%# DataBinder.Eval(Container.DataItem, "LastName") %></td>
                                    <td><%# DataBinder.Eval(Container.DataItem, "NickName") %></td>
                                    <td><%# (Gender)DataBinder.Eval(Container.DataItem, "Gender") %></td>
                                    <td><%# DataBinder.Eval(Container.DataItem, "Birthdate", "{0:M/d/yyyy}")%></td>
                                    <td><asp:Label ID="lblKidCategoryColumn" runat="server"></asp:Label></td>
                                    <td><%# DataBinder.Eval(Container.DataItem, "RelationshipWithGuardian") %></td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div class="block">
        <asp:UpdatePanel ID="updatePanelKid" runat="server" Visible="False">
            <ContentTemplate>
                <h3>Kid's Information</h3>
                <div class="left">
                    <table>
                        <tr>
                            <td>First Name:</td>
                            <td><asp:Label ID="lblKidFirstName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Middle Name:</td>
                            <td><asp:Label ID="lblKidMiddleName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Last Name:</td>
                            <td><asp:Label ID="lblKidLastName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Nick Name:</td>
                            <td><asp:Label ID="lblKidNickName" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Gender:</td>
                            <td><asp:Label ID="lblKidGender" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Birth Date:</td>
                            <td><asp:Label ID="lblKidBirthDate" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Category:</td>
                            <td><asp:Label ID="lblKidCategory" runat="server"></asp:Label></td>
                        </tr>
                        <tr>
                            <td>Allergies:</td>
                            <td><asp:TextBox ID="txtKidAllergies" runat="server" TextMode="MultiLine" Rows="5" ReadOnly="True"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td>Relationship with Guardian:</td>
                            <td><asp:Label ID="lblRelationshipWithGuardian" runat="server"></asp:Label></td>
                        </tr>
                    </table>
                </div>
                <div>
                    <table>
                        <tr>
                            <td>
                                Profile Photo:
                                <br />
                                <asp:Image runat="server" ID="kidImagePreview" CssClass="profilePhoto" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Additional Information:
                                <br />
                                <asp:TextBox ID="txtKidAdditionalInformation" runat="server" TextMode="MultiLine" Rows="5" ReadOnly="True"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <asp:Panel ID="panelControls" runat="server" CssClass="controls" Visible="False">
        <asp:Button ID="btnCheckOut" runat="server" CssClass="submitButton" Text="Check Out" OnClick="btnCheckOut_Click"/>
        <a href="#" onclick="window.history.back();">Back</a>
    </asp:Panel>
</asp:Content>
